package com.rest.util;

import com.google.gson.Gson;

import java.util.Map;

import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * @time 2021/4/19 9:56
 * Created by lbj on 2021/4/19 9:56.
 */
public class JsonUtil {

    private static final MediaType JSON = MediaType.parse( "application/json; charset=utf-8" );

    //map转json提交接口参数
    public static RequestBody listToJson(Map<String, Object> map) {
        String json = new Gson().toJson( map );
        return RequestBody.create( JSON, json );
    }
}
